<template>
  <section class="statistics">
    <div class="statistics-container">
      <h2 class="statistics-title">实时检索全链版权数据</h2>
      <p class="statistics-subtitle">为版权市场搭建一个全链全网信息互通的桥梁</p>
      
      <div class="statistics-list">
        <div class="statistics-item">
          <p class="statistics-number">{{ statistics.blockTotal }}</p>
          <p class="statistics-label">区块高度</p>
        </div>
        <div class="statistics-item">
          <p class="statistics-number">{{ statistics.nodeTotal }}</p>
          <p class="statistics-label">节点总数</p>
        </div>
        <div class="statistics-item">
          <p class="statistics-number">{{ statistics.transactionTotal }}</p>
          <p class="statistics-label">存证总数</p>
        </div>
        <div class="statistics-item">
          <p class="statistics-number">{{ statistics.userTotal }}</p>
          <p class="statistics-label">用户总数</p>
        </div>
      </div>

      <div class="statistics-action" @click="goToBlockchain">
        前往区块链浏览器
      </div>
    </div>
  </section>
</template>

<script>
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'DataStatistics',

  props: {
    statistics: {
      type: Object,
      required: true,
      default: () => ({
        blockTotal: 0,
        nodeTotal: 0,
        transactionTotal: 0,
        userTotal: 0
      })
    }
  },

  methods: {
    goToBlockchain() {
      window.open('http://wcl.btsi.org.cn/')
    }
  }
})
</script>

<style lang="scss" scoped>
.statistics {
  height: 320px;
  width: 100%;
  margin-top: -220px;
  position: relative;
  z-index: 100;

  &-container {
    width: $container-width;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: $spacing-extra-large $spacing-base;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    
    &:hover {
      transform: translateY(-5px);
      box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    }
  }

  &-title {
    font-size: 26px;
    color: #333;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
  }

  &-subtitle {
    font-size: 16px;
    color: #666;
    margin-top: 10px;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
  }

  &-list {
    display: flex;
    justify-content: center;
    margin: 40px auto 30px;
  }

  &-item {
    width: 280px;
    text-align: center;
    position: relative;
    
    &:not(:last-child):after {
      content: '';
      position: absolute;
      right: 0;
      top: 20%;
      height: 60%;
      width: 1px;
      background: linear-gradient(to bottom, transparent, #e0e0e0, transparent);
    }
  }

  &-number {
    color: $primary-color;
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    margin: 0 0 12px;
    background: linear-gradient(135deg, #1890ff, #53b7d7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInUp 0.8s ease-out forwards;
  }

  &-label {
    color: #555;
    font-size: 18px;
    margin: 0;
    font-weight: 500;
    animation: fadeIn 1s ease-out forwards;
  }

  &-action {
    font-size: 16px;
    padding: 10px 0;
    width: 180px;
    margin: 20px auto 0;
    color: $primary-color;
    border-bottom: 1px solid $primary-color;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;

    &:hover {
      color: darken($primary-color, 10%);
      border-bottom-color: darken($primary-color, 10%);
      transform: translateY(-2px);
      
      &:after {
        opacity: 1;
        right: -5px;
      }
    }
    
    &:after {
      content: '→';
      position: absolute;
      right: -10px;
      opacity: 0;
      transition: all 0.3s ease;
    }
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media screen and (max-width: 1200px) {
  .statistics {
    &-container {
      width: 90%;
    }
  }
}

@media screen and (max-width: 768px) {
  .statistics {
    height: auto;
    margin-top: -140px;
    padding-bottom: 30px;
    
    &-container {
      width: 90%;
      padding: 25px 15px;
    }

    &-list {
      flex-wrap: wrap;
      margin: 25px auto 15px;
    }

    &-item {
      width: 50%;
      margin-bottom: 25px;
      
      &:nth-child(2):after {
        display: none;
      }
    }
    
    &-number {
      font-size: 36px;
    }
    
    &-label {
      font-size: 16px;
    }
    
    &-subtitle {
      max-width: 95%;
    }
  }
}
</style> 